#ifndef LEETCODE_CN_CPP_PROBLEMS_11_H
#define LEETCODE_CN_CPP_PROBLEMS_11_H

#include <vector>

using namespace std;

namespace problem_11
{

class Solution
{
public:
    int maxArea(vector<int> &height)
    {
        int i = 0, j = height.size() - 1;
        int area = 0;
        while (i < j)
        {
            area = max(area, (j - i) * min(height[i], height[j]));
            if (height[i] < height[j])
            {
                i += 1;
            }
            else
            {
                j -= 1;
            }
        }
        return area;
    }
};

} // namespace problem_11

#endif //LEETCODE_CN_CPP_PROBLEMS_11_H
